﻿#region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;

    using Csla;

    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Private
{
    /// <summary>
    /// This class represents a collection of visit events that are experienced by a visit during it's lifetime.
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.DataAccess.Factory.VisitFactory, MarketPulse.DataAccess.Factory", "FetchVisitEventList")]
    public class VisitEventList : MarketPulseListBase<VisitEventList, VisitEvent>
    {

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private VisitEventList()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods
  
                /// <summary>
                /// Method used to create a new collection of VisitEventList objects via the DataPortal client proxy
                /// </summary>
                /// <returns>The newly created collection of visits</returns>
                internal static VisitEventList New()
                {                    
                    return DataPortal.CreateChild<VisitEventList>();
                }
               
                //// TODO ask Jeremy why he included this? some relevance or left over of prototype coding?
                //internal static VisitEventList Get(object childData)
                //{
                //    return DataPortal.FetchChild<VisitEventList>(childData);
                //}

                /// <summary>
                /// Method used to get a list of visit events that are associated with a specific Visit
                /// </summary>
                /// <param name="visitGUID">The Guid of the Visit to retrieve the visit event list for</param>
                /// <returns>The populated Visit Event List collection</returns>
                internal static VisitEventList Get(Guid visitGUID)
                {                    
                    return DataPortal.Fetch<VisitEventList>(new SingleCriteria<Guid>(visitGUID));
                }       

            #endregion       

        #endregion

    }
}
